/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
* File Name          : main.c
* Author             : MCU Shanghai team
* Version            : V0.0.1
* Date               : 10/21/2008
* Description        : EKSTM32F103 demo main file
********************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_lib.h"
#include "usb_lib.h"
#include "hw_config.h"
#include "usb_pwr.h"

#include "lcd.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Extern variables ----------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

/*******************************************************************************
* Function Name  : main.
* Description    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
	u16 i=0,j;
	volatile u16 key = KEY_NULL;
#ifdef DEBUG
  debug(); 
#endif

  Set_System();

  //Set_USBClock();
  //Led_Config();
	Backlignt_Config();
		
 // Key_Config();
	KeyX_config();
  KeyY_config();

  //JoyStick_Init();
  //Interrupts_Config();

  // EK_ADC_Init();


  SysTick_Init_start();


	
  //ADC_SoftwareStartConvCmd(ADC1, ENABLE);

 // USB_Init();
//  while (bDeviceState != CONFIGURED);
 // USB_Configured_LED();


//////////////////////////////////////////////

  GPIO_ResetBits(GPIOB,GPIO_Pin_11);
	j = GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_11);
	j = j;	

	 glcd_clear_ram();
  while (1)
  {
		i++;
		j = keyScan();
	
		   
		 glcd_circle(120,64,20,1);
		 glcd_circle_half(60,64,20,1);
		 glcd_box(150,20,180,60,1);
	}
}

#ifdef  DEBUG
/*******************************************************************************
* Function Name  : assert_failed
* Description    : Reports the name of the source file and the source line number
*                  where the assert_param error has occurred.
* Input          : - file: pointer to the source file name
*                  - line: assert_param error line source number
* Output         : None
* Return         : None
*******************************************************************************/
void assert_failed(u8* file, u32 line)
{
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {}
}
#endif

/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
